

#include <mtx_util.h>

extern char comp_readable;
extern char new_file;
extern char *new_file_name;

int inv_matrices(vm_matrix **mtx_array, int len){

  int i = 0;
  for ( ; i <= len; i++){
    vm_matrix *mtx = vm_inverse(mtx_array[i]);
    if (!mtx){
      return 0;
    }
    if (new_file){
      FILE *f = fopen(new_file_name, "w");
      if (comp_readable)
	vm_fprint_cr_matrix(f, mtx);
      else
	vm_fprint_matrix(f, mtx, "");
    } else {
      printf("Inverse of matrix:\n");
      vm_print_matrix(mtx, "  ");
    }
    vm_free_matrix(mtx);
  }
  
  return 1;

}
